home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / Terminal 2.2 / Project / Sources / ProtocolOptions.c < prev    next >
Text File  |  1992-01-17  |  3KB  |  96 lines

  1. /*
  2.     Terminal 2.2
  3.     "ProtocolOptions.c"
  4. */
  5.  
  6. #ifdef THINK_C
  7. #include "MacHeaders"
  8. #endif
  9. #ifdef applec
  10. #pragma load ":(Objects):MacHeadersMPW"
  11. #pragma segment Options
  12. #endif
  13.  
  14. #include "Options.h"
  15. #include "Strings.h"
  16. #include "Utilities.h"
  17. #include "Text.h"
  18. #include "Main.h"
  19. #include "MySF.h"
  20. #include "Procedure.h"
  21.  
  22. #define B_OK        1        /* OK button */
  23. #define B_CANCEL    2        /* Cancel button */
  24. #define C_BIN        3        /* MacBinary check box */
  25. #define C_CISB        4        /* CIS-B check box */
  26. #define    R_XYMODEM    5        /* X/Y-Modem radio button */
  27. #define R_ZMODEM    6        /* Z-Modem radio button */
  28. #define C_ZAUTORX    7        /* Z-Modem auto receive checkbox */
  29. #define B_FOLDER    8        /* Button to select new path */
  30. #define T_FOLDER    9        /* Path name for up- and downloads */
  31. #define U_TITLELINE    10        /* Underline */
  32. #define T_PROTOCOL    11        /* Protocol frame */
  33. #define U_PROTOCOL    12
  34.  
  35. /* ----- Protocol options dialog --------------------------------------- */
  36.  
  37. void ProtocolOptions(void)
  38. {
  39.     register DialogPtr dialog;
  40.     short number;
  41.     Byte str[256];
  42.     short volume = Settings.volume;
  43.     long directory = Settings.directory;
  44.  
  45.     CenterDialog('DLOG', DLOG_TRANSFER);
  46.     if (!(dialog = GetNewDialog(DLOG_TRANSFER, 0, (WindowPtr)-1L)))
  47.         return;
  48.     SetUserItem(dialog, U_TITLELINE, (ProcPtr)DrawUserLine);
  49.     SetUserItem(dialog, U_PROTOCOL, (ProcPtr)DrawUserFrame);
  50.     SetRadioButton(dialog, R_XYMODEM, R_ZMODEM, R_XYMODEM+Settings.ZModem);
  51.     SetCheck(dialog, C_BIN, Settings.Binary);
  52.     SetCheck(dialog, C_CISB, Settings.protocol);
  53.     SetCheck(dialog, C_ZAUTORX, Settings.ZAutoReceive);
  54.     Pathname(str, volume, directory);
  55.     SetEText(dialog, T_FOLDER, str);
  56.     ShowWindow(dialog);
  57.     for (;;) {
  58.         ModalDialog(0, &number);
  59.         switch(number) {
  60.             case B_OK:
  61.                 if (volume != Settings.volume ||
  62.                         directory != Settings.directory) {
  63.                     Settings.volume = volume;
  64.                     Settings.directory = directory;
  65.                     VolumeId(Settings.volumeName, &Settings.volume);
  66.                     Settings.dirty = TRUE;
  67.                 }
  68.                 TransferSetup(
  69.                     GetCheck(dialog, C_BIN),
  70.                     GetCheck(dialog, C_CISB),
  71.                     GetRadioButton(dialog,R_XYMODEM,R_ZMODEM) - R_XYMODEM,
  72.                     GetCheck(dialog, C_ZAUTORX));
  73.             case B_CANCEL:
  74.                 DisposDialog(dialog);
  75.                 return;
  76.             case C_BIN:
  77.             case C_CISB:
  78.             case C_ZAUTORX:
  79.                 ToggleCheckBox(dialog, number);
  80.                 break;
  81.             case B_FOLDER:
  82.             case T_FOLDER:
  83.                 /* Standard file dialog to select folder */
  84.                 if (SelectDirectory(&volume, &directory)) {
  85.                     Pathname(str, volume, directory);
  86.                     SetEText(dialog, T_FOLDER, str);
  87.                 }
  88.                 break;
  89.             case R_XYMODEM:
  90.             case R_ZMODEM:
  91.                 SetRadioButton(dialog, R_XYMODEM, R_ZMODEM, number);
  92.                 break;
  93.         }
  94.     }
  95. }
  96.